<?php
require_model('base.class');
class patientRegistration extends base {
    private $table = 'PatientRegistration';
    private $primary = 'RegistrationId';
    function __construct() {
        parent::__construct($this->table,$this->primary);
    }
    //添加咨询
    function CreateRegistration(){

    }
    //更改咨询
    function ModifyRegistration() {

    }
    //取消咨询
    function CancelRegistration() {

    }
    //查找咨询表
    function GetRegistrationById() {

    }
    //查找患者的咨询表
    function GetRegistrationByPatientId($patient_id) {
        return $this->get_items(array('PatientId'=>$patient_id));
    }
    //$is_expert 是否专家 true：是: false:否
    //$is_expert=true时，$doctor_username用户的助手数组.否则为用户的username
    function GetRegistrationByDoctorId($doctor_username,$is_expert=false) {
        $obj = $this->db->create_mapper($this->table);
        if($is_expert && $doctor_username) {
            $obj->where_col('DoctorId', $doctor_username, 'IN')->where(array('Status'=>2, 'OrderStatus'=>3));
        }else {
            $obj->where(array('CurrentDoctorId'=>$doctor_username, 'Status'=>0, 'OrderStatus'=>3));
        }
        $res = $obj->where(array('PayStatus'=>1))->order('ReferralCode',false)->order('PayTime',false)->find_all_by();
        return $res ? $res : array();
    }
    function GetRegistrationPageByDoctorId(array & $request, array & $response) {
        $is_expert = isset($request['is_exper']) ? $request['is_expert'] : false;
        $doctor_username = isset($request['doctor_username']) ? $request['doctor_username'] : '';
        $obj = $this->db->create_mapper($this->table);
        if($is_expert && $doctor_username) {
            $obj->where_col('DoctorId', $doctor_username, 'IN')->where(array('Status'=>2, 'OrderStatus'=>3));
        }else {
            $obj->where(array('CurrentDoctorId'=>$doctor_username, 'Status'=>0, 'OrderStatus'=>3));
        }
        $obj->where(array('PayStatus'=>1))->order('ReferralCode',false)->order('PayTime',false)->find_all_by();
        load_model('page')->get_page_row($obj, $request, $response);
    }

    //根据状态查找咨询表
    function GetRegistrationByOrderStatus() {

    }
    //支付预检
    function DoPaymentForRegistration() {

    }
    //预检加价
    function RaisePaymentForRegistration() {

    }
    //添加预检
    function RegistrationPreflightSelect() {

    }
    //取消预检
    function RegistrationPreflightDeSelect() {

    }
    //预检返回
    function RegistrationPreflightReturn() {

    }
    //遇见提交
    function RegistrationPreflightREsubmit() {

    }
    //预检通过
    function RegistrationPreflightPass() {

    }
    //咨询选择
    function RegistrationConsultSelect() {

    }
    //服务电话
    function RegistrationConsultReserverCall() {

    }
    //提交咨询服务电话
    function RegistrationConsultModifyReserverCall() {

    }
    //取消咨询服务电话
    function RegistrationConsultCancelReserverCall() {

    }
    //取消咨询
    function RegistrationConsultDeSelect() {

    }
}